package ups.MapParse;

public final class Point {
	public int x;
	public int y;
	
	public Point( int X, int Y)
	{
		this.x = X;
		this.y = Y;
	}
	
	public double distanceFrom( Point otherPoint ) {
		return Math.sqrt(  ((this.x - otherPoint.x ) * (this.x - otherPoint.x )) +
						   ((this.y - otherPoint.y ) * (this.y - otherPoint.y )) );
	}
	
	public String toString() {
		return "(" + this.x + ", " + this.y + ")";
	}
	
	public boolean equals( Object o ) {
		if( o.getClass() == this.getClass() ) {
			Point other = (Point)o;
			if( this.x == other.x && this.y == other.y ) {
				return true;
			}
		}
		
		return false;
	}
	
	public int hashCode() {
	//	System.out.println( "Checking hashcode");
		return this.x * 100 + this.y;
	}
	
}